package com.panopset.game.blackjack;

/**
 * Basic strategy recommended action.
 *
 * @author Karl Dinwiddie
 *
 */
public class RecommendedAction {

    private final String cmd;
    private final String originalMnemonic;

    public String getCommand() {
        return cmd;
    }

    public String getOriginalMnemonic() {
        return originalMnemonic;
    }

    public RecommendedAction(final String command, final String mnemonic) {
        cmd = command;
        originalMnemonic = mnemonic;
    }

    public boolean isVariableDecision(Hand hand) {
        final String om = getOriginalMnemonic();
        if ("H*".equals(om)) {
            if (hand != null && hand.isInitialDeal()) {
                return true;
            }
            return false;
        }
        if ("R*".equals(om) || "Rh".equals(om) || "Rs".equals(om)) {
            if (hand != null && hand.isInitialDeal()) {
                return true;
            }
            return false;
        }
        if ("Hd".equals(om)) {
            if (hand != null && hand.isInitialDeal()) {
                return true;
            }
            return false;
        }
        return om.length() > 1 && !"Dh".equals(om) && !"Ds".equals(om);
    }

    @Override
    public String toString() {
        return getOriginalMnemonic() + ": " + getCommand();
    }
}
